library(ggplot2)
library(scales)
load('~/Research/taboo/processed_data/EDA.RData') 
load('~/Research/taboo/processed_data/artDF.RData')


ls()
basePath = "~/Research/taboo/" 
posterPath = ('~/Dropbox/Apps/Overleaf/[Poster] Taboo Topics/figures/')
dataPath = paste0(basePath, 'processed_data/')
knitrPath = paste0(basePath, 'knitr_rdata/')
figPath = paste0(basePath, 'figures/')
docPath = paste0('~/Dropbox/Apps/Overleaf/[CSCW] Taboo Subjects/figures/')

reverselog_trans <- function(base = exp(1)) {
  trans <- function(x) -log(x, base)
  inv <- function(x) base^(-x)
  trans_new(paste0("reverselog-", format(base)), trans, inv, 
            log_breaks(base = base), 
            domain = c(1e-100, Inf))
}

g <- ggplot(artDF, aes(x=avgViewRank, y=source, fill=source)) +
  geom_boxplot(alpha=.5, width=0.75) +
  scale_x_continuous(trans='reverse') +
  scale_y_discrete(labels=c("Comparison", "Taboo")) +
  #theme_bw() +
#  scale_color_discrete(name="Source", labels=c("Random", "Taboo")) +
  #theme(legend.position = 'none', axis.title.x = element_blank()) +
  theme(panel.background = element_blank(), panel.grid = element_blank(), 
        legend.position = "none", axis.line = element_line(color = "black"),
        axis.text=element_text(size=12)) +
  stat_summary(fun=mean, geom="point", shape=24, size=3, color="black", fill="black") +
labs(x="View Rank", y=element_blank())

g

pdf(paste0(figPath, "viewsBox.pdf"), width = 8, height = 3)
g
dev.off()

pdf(paste0(docPath, "viewsBox.pdf"), width = 8, height = 3)
g
dev.off()

pdf(paste0(posterPath, "viewsBox.pdf"), width = 8, height = 3)
g
dev.off()

